#!/usr/bin/python -S
"""
util_test.py: Tests for util.py
"""

__author__ = 'Andy Chu'

import os
import sys
import unittest

import util


class UtilTest(unittest.TestCase):

  def testBlockStr(self):
    B = util.BlockStr

    self.assertEqual(
      B("""
        one
        two
        three
        """),
        'one\ntwo\nthree\n')

    self.assertEqual(
      B("""
        """),
        '')

    self.assertEqual(
      B("""
        a
        """),
        'a\n')

    self.assertEqual(
      B("""
          An indented string
        """),
        '  An indented string\n')

    self.assertRaises(util.BlockStrError,
        B, """
An error.""")

    self.assertRaises(util.BlockStrError,
        B, '')


if __name__ == '__main__':
  unittest.main()
